<?php
/**
 * Store date begin and end to filter elements on the date
 *
 * @package    letsManager
 * @subpackage model
 * @author     Jerome Fouilloy
 * @version    SVN: $Rev$
 */
class DateQueryRange {
	
	private $start = 0;
	private $end =0;
	
	public function __construct($end = 0,$start = 0)
	{
		
		$this->start = $start;
		if($end == 0)
		{
			$this->end = time();
		}
		else{
			$this->end = $end;
		}
	}
	public function addWhereQuery(Doctrine_Query $q,$fieldName)
	{
		$q->andWhere($fieldName . ' <= ?',date('Y-m-d',$this->end));
		if($this->start > 0)
		{
			$q->andWhere($fieldName . ' >= ?',date('Y-m-d',$this->start));
		}		
	}
	public static function lastMonth()
	{
		
	}
	public static function lastYear()
	{
		
	}
}